package cn.com.code.design;

import java.util.*;

/**
 * 组成最大数
 *
 * @author zhengpei
 * @date 2022/5/16
 */
public class Hwjs01 {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    while (scanner.hasNext()) {
      String str = scanner.nextLine();
      System.out.println(maxNum(str));
    }
  }

  private static String maxNum(String str) {
    String[] split = str.split(",");

    Arrays.sort(split, (o1, o2) -> {
      String str1 = o1 + o2;
      String str2 = o2 + o1;
      return (str1.compareTo(str2));
    });
    StringBuilder stringBuilder = new StringBuilder();
    for (int i = split.length - 1; i >= 0; i--) {
      stringBuilder.append(split[i]);
    }
    return stringBuilder.toString();
  }

}
